package pers.cocoadel.cloud.movie.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pers.cocoadel.cloud.movie.domain.Student;
import pers.cocoadel.cloud.movie.domain.User;
import pers.cocoadel.cloud.movie.feign.UserClient;
import pers.cocoadel.cloud.movie.feign.StudentClient;

@RequestMapping("/movies")
@RestController
public class MovieController
{
    @Autowired
    private UserClient userClient;

    @Autowired
    private StudentClient studentClient;

    @GetMapping("/users/{id}")
    public User findById(@PathVariable Long id)
    {
        User user = userClient.findById(id);
        // ...电影微服务的业务...
        return user;
    }

    @GetMapping("/student/{id}")
    public Student findStudentById(@PathVariable Long id)
    {
        Student student = studentClient.findById(id);
        // ...电影微服务的业务...
        return student;
    }
}
